package com.xxyf.domain;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Author 小小怡飞
 * @Date 2022/12/14 20:06
 * @Version JDK 8
 */
@Data

public class Rest <T>{
    private T data;
    private String msg;
    private Integer code;

    public Rest(){
        this.msg=Code.SUCCEED.getMag();
        this.code=Code.SUCCEED.getCode();
        data=null;
    }
    public Rest(Code code){
        this.msg=code.getMag();
        this.code=code.getCode();
        data=null;
    }
    public Rest(T data){
        this.msg=Code.SUCCEED.getMag();
        this.code=Code.SUCCEED.getCode();
        this.data=data;
    }
    public Rest(String msg,T data){
        this.msg=msg;
        this.code=Code.SUCCEED.getCode();
        this.data=data;
    }
    public Rest(Code code,String msg){
        this.msg=msg;
        this.code=code.getCode();
        this.data=null;
    }

    public Rest(Code code,T data){
        this.msg=code.getMag();
        this.code=code.getCode();
        this.data=data;
    }
    public Rest(Code code,String msg,T data){
        this.msg=msg;
        this.code=code.getCode();
        this.data=data;
    }
    public Rest(Integer code,String msg,T data){
        this.msg=msg;
        this.code=code;
        this.data=data;
    }
}
